const tools = {
	hrefPage(name) {
		uni.navigateTo({
			url: `/pages/${name}/${name}`
		})
	},
	hrefPackage(name) {
		uni.navigateTo({
			url: `/subpackage_pages/${name}`
		})
	},
	navigatoTo(url) {
		uni.navigateTo({
			url
		})
	},
	cdnurl(str) {
		let regex = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
		//CDN地址
		let domain = `https://zycdn1.keguan.space/ichiban/new/images/`
		if (regex.test(str)) {
			return str;
		} else {
			return `${domain}${str}`;
		}
	}
}
export default tools